<template>
	<view class="page" :style="{minHeight:windowHeight+'px'}">
		<!-- <view class="head" :style="{backgroundImage:'url('+headbg+')'}"> -->
		<view class="head">
			<view class="return" @click="gotoPage('/pages/user/user-car/allUser_car/allUser_car')">
				<image src="../../../../static/whiBg.png"></image>
			</view>
			<swiper class="swiper-msg" circular="" autoplay="false" duration="500" interval="4000">
		     	<swiper-item class="swiper-msg-item"  v-for="(item, index) in 5"  :key="index">
					<image :src="car.car_info3"></image>
			     </swiper-item>
		    </swiper>
		</view>
		<view class="content1">
			<view class="con-car">
				<text>{{car.product_type}}</text>
				<text>{{car.content}}</text>
			</view>
			<view class="price">&yen {{car.product_discharge}}</view>
		</view>
		<view class="content2">
			<text class="file">车辆档案</text>
			<view class="content2-item">
				<view class="content2-con">
					<text>表显里程</text>
					<view>{{car.product_journey}}公里</view>
				</view>
				<view class="content2-con">
					<text>上牌时间</text>
					<view>{{car.product_time}}</view>
				</view>
				<view class="content2-con">
					<text>变速箱</text>
					<view>{{car.product_box}}</view>
				</view>
			</view>
			<view class="content2-item">
				<view class="content2-con">
					<text>出售价格</text>
					<view>{{car.product_discharge}}</view>
				</view>
				<view class="content2-con">
					<text>过户</text>
					<view>{{car.product_transfer}}次过户</view>

				</view>
				<view class="content2-con">
					<text>新车含税价</text>
					<view>{{car.product_price}}元</view>
				</view>
			</view>
			<view class="content2-item">
				<view class="content2-con">
					<text>卖车地点</text>
					<view>{{car.product_address}}</view>
				</view>
				<view class="content2-con">
					<text>联系电话</text>
					<view class="phone" @click="phoneCall">{{car.mobile}}</view>
				</view>
				<view class="content2-con">
					<!-- <text>变速箱</text>
					<view>{{car.product_box}}</view> -->
				</view>
			</view>
		</view>
		<!-- 没有记录 -->
		<view class="nullmsg d-c-c p30" v-if="car.length == 0">
			<text class="iconfont icon-wushuju"></text>
			<text class="cont">亲，暂无相关记录哦</text>
		</view>
		<!-- <uni-load-more class="not" v-else :loadingType="loadingType"></uni-load-more> -->
	</view>
</template>

<script>
	import uniLoadMore from '@/components/uni-load-more.vue';
	export default {
		components: {
			uniLoadMore
		},
		data() {
			return {
				headbg: '',
				userCar_id: '',
				car: '',
				windowHeight:''
			};
		},
		computed: {
			/*加载中状态*/
			loadingType() {
				if (this.loading) {
					return 1;
				} else {
					if (this.car.length != 0) {
						return 2;
					} else {
						return 0;
					}
				}
			}
		},
		onLoad(e) {
			//this.userCar_id=e.userCar_id;
			if (e.select == 1) {
				this.userCar_id = e.userCar_id;
				this.getData(this.userCar_id);
			}
			uni.getSystemInfo({
				success: (res) => {
					this.windowHeight=res.windowHeight;
				}
			})
		},
		methods: {
			phoneCall() {
				let self = this;
				console.log(self.car.mobile);
				uni.makePhoneCall({
					phoneNumber: self.car.mobile
				});
			},
			/*跳转页面*/
			gotoPage(path) {
				let self = this;
				if (path.startsWith('/')) {
					uni.navigateTo({
						url: path
					});
				} else {
					self[path]();
				}
			},
			/*获取数据*/
			getData() {
				let self = this;
				uni.showLoading({
					title: '加载中'
				});
				//let userCar_id = self.userCar_id;
				self._post('car.index/use_car_info', {
						userCar_id: self.userCar_id,
					},
					function(res) {
						console.log(res);
						self.car = res.data.car;
						//self.headbg=res.data.car.car_info3;
						//console.log(res);
						self.loadding = false;
						uni.hideLoading();
					});
			},
		}
	}
</script>

<style lang="scss">
	.page {
		width: 100%;
		height: 100%;
		background-color: #F4F4F4;
	}

	.head {
		width: 100%;
		height: 500rpx;
		//background-image: url(../../../../static/car1.png);
	}
	.swiper-msg-item,.swiper-msg{
		position: relative;
		top: 0rpx;
		width: 100%;
		height: 500rpx;
	}
	.swiper-msg-item image{
		width: 100%;
		height: 100%;
		display: block;
	}
	.return {
		position: absolute;
		top: 80rpx;
		left: 36rpx;
	}

	.return image {
		width: 20rpx;
		height: 35rpx;
		//margin: 20rpx;
		z-index: 99;
		//clear: both;
		//margin-top: 60rpx;
	}

	.content1 {
		width: 100%;
		//height: 140rpx;
		background-color: #FFFFFF;
		overflow: hidden;
	}

	.con-car {
		margin-left: 16rpx;
		margin-top: 20rpx;
	}

	.content1 text,
	.price,
	.file {
		font-weight: 900;
		font-size: 36rpx;
		margin-right: 10rpx;
	}

	.price {
		margin-left: 16rpx;
		margin-top: 10rpx;
		color: #fe8558;
		margin-bottom: 16rpx;
	}

	.content2 {
		//width: 100%;
		background-color: #FFFFFF;
		//padding: 20rpx;
		margin-top: 20rpx;
		padding: 16rpx 0;
		padding-left: 20rpx;
	}

	.content2-item {
		margin-top: 30rpx;
		display: flex;
	}

	.content2-item text {
		color: #8E8F92;
	}

	.content2-con {
		width: 290rpx;
	}

	.content2-con view {
		margin-top: 6rpx;
		font-size: 30rpx;
	}
	.nullmsg{
		position: fixed;
		width: 100%;
		height: 100%;
		top: 0;
		background-color: #ffffff;
		margin-top: 0;
	}
	.phone{
		color: #5864FD;
	}
</style>
